package com.zhiyou100.controller.repair;

import com.zhiyou100.dao.Impl.RepairDaoImpl;
import com.zhiyou100.emtity.Repair;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sound.midi.Soundbank;
import java.io.IOException;

/**
 * @description:
 * @author: 马跃
 * @create: 2021-01-22 10:10
 **/
@WebServlet("/repairQuery")
public class RepairQueryServlet extends HttpServlet {

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int id = Integer.parseInt(request.getParameter("id"));
        System.out.println(id);
        Repair repair= new RepairDaoImpl().query(id);
        System.out.println(repair);
        request.getSession().setAttribute("repair", repair);
        request.getRequestDispatcher("./serve/repairDetails.jsp").forward(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
